<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>添加 员工</title>
    <style>
        body { font-family: Arial, sans-serif; background-color: #f5f5f5; }
        .container { width: 500px; margin: 30px auto; padding: 20px; background: white; border-radius: 5px; box-shadow: 0 0 10px rgba(0,0,0,0.1); }
        h1 { text-align: center; color: #333; }
        .form-group { margin-bottom: 20px; }
        label { display: block; margin-bottom: 5px; font-weight: bold; color: #555; }
        input[type="text"], input[type="number"], input[type="date"], select {
            width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box;
        }
        .btn-container { display: flex; justify-content: space-between; margin-top: 20px; }
        .btn { padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer; font-size: 16px; }
        .btn-primary { background-color: #4CAF50; color: white; }
        .btn-secondary { background-color: #f44336; color: white; }
    </style>
</head>
<body>
<div class="container">
    <h1>添加新员工</h1>

    <form action="addEmployee" method="post">
        <div class="form-group">
            <label for="name">姓名：</label>
            <input type="text" id="name" name="name" required>
        </div>

        <div class="form-group">
            <label for="gender">性别:</label>
            <select id="gender" name="gender" required>
                <option value="">选择性别</option>
                <option value="Male">男</option>
                <option value="Female">女</option>
                <option value="Other">不方便透露</option>
            </select>
        </div>

        <div class="form-group">
            <label for="age">年龄:</label>
            <input type="number" id="age" name="age" min="18" max="65" required>
        </div>

        <div class="form-group">
            <label for="deptId">部门:</label>
            <select id="deptId" name="deptId" required>
                <c:forEach items="${departments}" var="dept">
                    <option value="${dept.deptId}">${dept.deptName}</option>
                </c:forEach>
            </select>
        </div>

        <div class="form-group">
            <label for="position">职位:</label>
            <input type="text" id="position" name="position" required>
        </div>



        <div class="btn-container">
            <button type="button" class="btn btn-secondary" onclick="window.location.href='employees'">返回</button>
            <button type="submit" class="btn btn-primary">添加员工</button>
        </div>
    </form>
</div>


</body>
</html>